**************************************************************************************
* THIS DO-FILE REPLICATES THE ANALYSIS IN FALCKE & VINK (2020)
* Falcke, S. & Vink, M. (2020). Closing a Backdoor to Dual Citizenship. The German Citizenship Law Reform of 2000.
* do-file written by Swantje Falcke
* November 2020
**************************************************************************************

use FalckeVink2020.dta


*-------------------------------------------------------------------------------------
* Restrict Sample
*-------------------------------------------------------------------------------------

run FalckeVink2020_SampleRestriction.do

*-------------------------------------------------------------------------------------
* Analysis
*-------------------------------------------------------------------------------------
global controls sex age age2 ysm ysm2 i.yeareduc_cat married marriedCitizen i.working_m child18 hhincome_cat EU
global options absorb(bula2_m rorigin_broad) vce(cluster pid)
global options2 absorb(bula2_m) vce(cluster pid)



***Figure 3***
* Panel a: The unadjusted cumulative naturalisation rate between 1993 and 2006 *
preserve
collapse (mean) y, by(syear treatment)
sum
reshape wide y, i(syear) j(treatment)
rename (y1 y0 ) (y_t y_c)
twoway (line y_t syear, lpattern(solid)) ///
	(line y_c syear, lpattern(dash)), ///
	legend(label(1 "Treatment") label(2 "Control")) ///
	xline(2000) ///
	xtitle("Year") ///
	ytitle("Naturalization Rate")
restore

* Panel b: Differences in naturalisation rates between Treatment and control *
reghdfe y treatment#ib1993.syear $controls, $options 
preserve
parmest, fast
replace parm="1.treatment#1990b.syear" if parm=="1o.treatment#19b.syear"
keep if substr(parm,1,5)=="1.tre"
gen year=substr(parm,13,4)
drop if missing(year)
destring year, replace
set obs 20
replace year = 1990 in 20
replace est = 0 if year == 1990
sort year
twoway(scatter est year)(rcap min95 max95 year), legend(off) yline(0) xline(2000) xtitle("Year") ytitle("Difference in Naturalization Rate b/w Treatnment and Cotrol" "(percentage points)")
restore

*** Table 1 (and A2): The impact of the abolishment of the domestic clause in 2000 on naturalisation rates ***
eststo: reghdfe y treatment interaction post2000 $controls, $options
eststo: reghdfe y treatment interaction post2000 $controls if syear>=1994 & syear<=2005, $options
eststo: reghdfe y treatment interaction post2000 $controls if syear>=1995 & syear<=2004, $options
eststo: reghdfe y treatment interaction post2000 $controls if syear>=1996 & syear<=2003, $options
esttab using obswindow.rtf,replace keep(interaction) se mtitles("1993-2006" "1994-2005" "1995-2004" "1996-2003") 
esttab using obswindow2.rtf,replace se mtitles("1993-2006" "1994-2005" "1995-2004" "1996-2003") 

*** Table 2: The impact of the abolihsment of the domestic clause in 2000 on naturalisation rates, excluding EU citizens that can be dual citizens after 2000 based on reciprocity ***
gen EU_reci=0
replace EU_reci=1 if ccode3=="BEL" | ccode3=="FRA"| ccode3=="GRC"
replace EU_reci=1 if ccode3=="IRL" | ccode3=="ITA"| ccode3=="PRT"
replace EU_reci=1 if ccode3=="CHE" | ccode3=="GBR"| ccode3=="SWE"
replace EU_reci=1 if ccode3=="FIN" | ccode3=="CYP"| ccode3=="MLT" | ccode3=="SVK"
replace EU_reci=1 if corigin==26

eststo clear
eststo: reghdfe y treatment interaction post2000 $controls if EU_reci!=1, $options
eststo: reghdfe y treatment interaction post2000 $controls if EU_reci!=1 & syear>=1994 & syear<=2005, $options
eststo: reghdfe y treatment interaction post2000 $controls if EU_reci!=1 & syear>=1995 & syear<=2004, $options
eststo: reghdfe y treatment interaction post2000 $controls if EU_reci!=1 & syear>=1996 & syear<=2003, $options
esttab using obswindow2.rtf,replace se mtitles("1993-2006" "1994-2005" "1995-2004" "1996-2003") 
esttab using obswindow.rtf,replace keep(interaction) se mtitles("1993-2006" "1994-2005" "1995-2004" "1996-2003") 


*** Figure 4***
* Panel a: The unadjusted naturalisation rate between 1993 and 2006 for Turkish vs. other migrants*
preserve
collapse (mean) y, by(syear treatment2)
sum
reshape wide y, i(syear) j(treatment2)
rename (y1 y0 ) (y_t y_c)
twoway (line y_t syear, lpattern(solid)) ///
	(line y_c syear, lpattern(dash)), ///
	legend(label(1 "Turkey") label(2 "Other")) ///
	xline(2000) ///
	xtitle("Year") ///
	ytitle("Naturalization Rate")
restore

* Panel b: Differences in naturalisation rates between Turkish migrants (treatment group) and other (control group) over time*
preserve
reghdfe y treatment2##ib1993.syear $controls, $options2 
parmest, fast
replace parm="1.treatment2#1993b.syear" if parm=="1o.treatment2#1993b.syear"
keep if substr(parm,1,5)=="1.tre"
gen year=substr(parm,14,4)
drop if missing(year)
destring year, replace
twoway(scatter est year)(rcap min max year), legend(off) yline(0) xline(2000) xtitle("Year") ytitle("Difference in Naturalization Rate b/w Treatnment and Cotrol" "(percentage points)")
restore


*** Table 3: The impact of the abolishment of the domestic clause in 2000 for Turkish migrants ***
eststo clear
eststo: reghdfe y treatment2 interaction2 post2000 $controls, $options2
eststo: reghdfe y treatment2 interaction2 post2000 $controls if syear>=1994 & syear<=2005, $options2
eststo: reghdfe y treatment2 interaction2 post2000 $controls if syear>=1995 & syear<=2004, $options2
eststo: reghdfe y treatment2 interaction2 post2000 $controls if syear>=1996 & syear<=2003, $options2
esttab using turkey.rtf,replace keep(interaction2) se mtitles("1993-2006" "1994-2005" "1995-2004" "1996-2003") 

*** Table A1: Summary statistics ***
fre y treatment sex married marriedCitizen working yeareduc_cat hhincome_cat child18 EU EU15 Turkey refugee rorigin rorigin_broad bula2
bysort treatment: fre y treatment sex married marriedCitizen working yeareduc_cat hhincome_cat child18 EU EU15 Turkey refugee rorigin_broad bula2
bysort post2000: fre y treatment sex married marriedCitizen working yeareduc_cat hhincome_cat child18 EU EU15 Turkey refugee rorigin_broad bula2
sum age ysm yeareduc hhincome
bysort treatment: sum age ysm
bysort post2000: sum age ysm

*** Table A3: The impact of the abolishment of the domestic clause in 2000 for Turkish migrants, excluding EU citizens that can be dual citizens after 2000 based on reciprocity ***
eststo clear
eststo: reghdfe y treatment2 interaction2 post2000 $controls if EU_reci!=1, $options2
eststo: reghdfe y treatment2 interaction2 post2000 $controls if EU_reci!=1 & syear>=1994 & syear<=2005, $options2
eststo: reghdfe y treatment2 interaction2 post2000 $controls if EU_reci!=1 & syear>=1995 & syear<=2004, $options2
eststo: reghdfe y treatment2 interaction2 post2000 $controls if EU_reci!=1 & syear>=1996 & syear<=2003, $options2
esttab using obswindow2.rtf,replace se mtitles("1993-2006" "1994-2005" "1995-2004" "1996-2003") 
esttab using obswindow.rtf,replace keep(interaction2) se mtitles("1993-2006" "1994-2005" "1995-2004" "1996-2003") 

*** Table A4: The impact of the abolishment of the domestic clause in 2000 for Turkish migrants, excluding other migrants affected from the abolishment of the domestic clause ***
gen non_turkey_treatment=.
replace non_turkey_treatment=1 if treatment==1 & Turkey==0
eststo clear
eststo: reghdfe y treatment2 interaction2 post2000 $controls if non_turkey_treatment!=1, $options2
eststo: reghdfe y treatment2 interaction2 post2000 $controls if non_turkey_treatment!=1 & syear>=1994 & syear<=2005, $options2
eststo: reghdfe y treatment2 interaction2 post2000 $controls if non_turkey_treatment!=1 & syear>=1995 & syear<=2004, $options2
eststo: reghdfe y treatment2 interaction2 post2000 $controls if non_turkey_treatment!=1 & syear>=1996 & syear<=2003, $options2
esttab using turkey.rtf,replace keep(interaction2) se mtitles("1993-2006" "1994-2005" "1995-2004" "1996-2003") 

